#! /bin/bash

# 根目录
ROOT_PATH=$(dirname "$PWD")
echo "root path: $ROOT_PATH"
sleep 2

echo "=================================> build project..."
# -U: 强制下载最新快照
cd $ROOT_PATH && mvn -T 1C clean install package -Dmaven.test.skip=true -U

rm -rf docker/be/system/*.jar
rm -rf docker/be/auth/*.jar
rm -rf docker/be/gateway/*.jar

cp fastdev-system/fastdev-system-biz/target/*.jar docker/be/system
cp fastdev-auth/target/*.jar docker/be/auth
cp fastdev-gateway/target/*.jar docker/be/gateway

# \r\n to \r
cd $ROOT_PATH/docker/
find . -name "*.sh" | xargs sed -i "s/\r//g"